package sync
{
	import events.P2PMessageEvent;
	
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	import flash.sampler.NewObjectSample;

	public class P2PMessageReceiver extends EventDispatcher
	{
		/**
		 * This class is responsible for receiving actions from the other peeps
		 */ 
		public function P2PMessageReceiver(target:IEventDispatcher = null)
		{
			super(target);
		}
		
		public function messageReceived(message:Object):void
		{
			//extract the data form the message
			
			//post
			var event:P2PMessageEvent = new P2PMessageEvent(P2PMessageEvent.MESSAGE_RECEIVED);
			event.objectToSend = message;
			dispatchEvent(event);
		}
	}
}